<div class="am-panel am-panel-default">
    <div class="am-panel-bd">


        <input type='file'  name='photo' onchange='PreviewImage(this)'>
        <script>
            function PreviewImage(imgFile)
            {
                var filextension=imgFile.value.substring(imgFile.value.lastIndexOf("."),imgFile.value.length);
                filextension=filextension.toLowerCase();
                if ((filextension!='.jpg')&&(filextension!='.gif')&&(filextension!='.jpeg')&&(filextension!='.png')&&(filextension!='.bmp'))
                {
                    alert(" 图片格式不正确!");
                    imgFile.focus();
                }
                else
                {
                    var path;
                    if(document.all)//IE
                    {
                        imgFile.select();
                        path = document.selection.createRange().text;
                        document.getElementById("imgPreview").innerHTML="";
                        document.getElementById("imgPreview").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\"" + path + "\")";//使用滤镜效果
                    }
                    else//FF
                    {
                        path=window.URL.createObjectURL(imgFile.files[0]);// FF 7.0以上
                        //path = imgFile.files[0].getAsDataURL();// FF 3.0
                        document.getElementById("imgPreview").innerHTML = "<img id='img1' width='120px' height='100px' src='"+path+"'/>";
                        //document.getElementById("img1").src = path;
                    }
                }
            }
        </script>

    </div>
    <div id="imgPreview" class="am-panel-bd">
        <img id="img1" src="" width="100" height="100" />
        <br>   <br>
    </div>
</div>

